<template>
  <div class="appCenter">
    <el-row
      :gutter="24"
      v-for="ind in Math.ceil(apps.length / 4)"
      :key="`row-${ind}`"
    >
      <el-col
        :span="6"
        v-for="(item, index) in apps.slice((ind - 1) * 4, ind * 4)"
        :key="`col-${ind}-${index}`"
      >
        <app-card :appInfo="item" @getApps="getApps" />
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getAllApps } from "@/http/api";
import AppCard from "@/components/public/AppCard.vue";
export default {
  components: { AppCard },
  name: "appCenter",
  data() {
    return {
      apps: [],
    };
  },
  mounted() {
    this.getApps();
  },
  methods: {
    async getApps() {
      let res = await getAllApps();
      if (res.code === 20041) {
        this.apps = res.data;
      }
    },
  },
};
</script>
<style lang="less" scoped>
.appCenter {
  width: 100%;
  .el-row {
    margin-bottom: 26px;
  }
}
</style>
